package com.tpo.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.tpo.base.GridRequest;
import com.tpo.base.ResultGrid;
import com.tpo.dao.Tpo_roleMapper;
import com.tpo.model.Tpo_role;
import com.tpo.model.bean.RoleGrid;
import com.tpo.service.RoleService;

 
 

@Controller
@RequestMapping("admincontrol")
public class AdminController {
	/**Description:admin role by adminnistrator
	 * @param role contains rolename and remark
	 * @return if success return 1,else 0
	 * */
	@RequestMapping("addtporole")
	@ResponseBody
	public int add_tpo_role(Tpo_role role,HttpSession session){ 
		role.setRid(null); 
		return rolemapper.insertSelective(role); 
	}
	
	
	
	/**Description:get all role as list for admin
	 * @param record 
	 * */
	@RequestMapping("rolelist")
	@ResponseBody
	public ResultGrid<Tpo_role> rolelist(RoleGrid record ){
		return roleservice.getrolelist(record);
	}
	
	
	
	
	
	
	/*========it is used for autowired===========================================================================*/
	@Autowired
	Tpo_roleMapper rolemapper;
	@Autowired
	RoleService roleservice;
}
